package com.wcy.util.vo;

import com.wcy.entity.userVo.UserFiltered;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.util.List;
import java.util.Map;

@Data
public class AuthResponse {
    private final String token;
    private final UserFiltered user;
    private Object perms;

    public AuthResponse(Map<String, Object> map) {
        this.token = map.containsKey("token") ?map.get("token").toString():"";
        this.user = map.containsKey("user") ? new UserFiltered((Map)map.get("user")):null;
        this.perms = map.getOrDefault("perms", null);
    }

    public AuthResponse(){
        perms = null;
        token = "";
        user = null;
    }

    public AuthResponse(String token,UserFiltered user,Object perms) {
        this.token = token;
        this.user = user;
        this.perms = perms;
    }
}
